﻿<!DOCTYPE HTML>
<html>
{include file="public:header_css"}
<body>
<nav class="breadcrumb">
	<i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 营销管理 <span class="c-gray en">&gt;</span> 增值列表
	<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container">
    <div class="cl pd-5 bg-1 bk-gray mt-20">
        <span class="l">
            <a class="btn btn-primary radius" href="{:url('add')}">
				<i class="Hui-iconfont">&#xe600;</i> 添加增值服务
			</a>
		</span>
        <span class="r">共有数据：<strong>{$total}</strong> 条</span>
	</div>

	<div class="mt-20">
		<table class="table table-border table-bordered table-bg table-hover table-sort">
			<thead>
			<tr class="text-c">
				<th width="80">ID</th>
				<th width="150">主菜单</th>
				<th width="150">费用</th>
				<th width="150">有效期</th>
				<th width="60">状态</th>
				<th width="100">操作</th>
			</tr>
			</thead>
			<tbody>
			{foreach name="list" item="v" key="k"}
			<tr class="text-c">
				<td>{$v.id}</td>
				<td class="text-c">{$v.primary_menu}</td>
				<td class="text-c">{$v.price}元</td>
				<td class="text-c">{$v.period_validity}天</td>
				<td class="td-status">
					{if $v.status == 0}
						<span class="label label-success radius" onClick="is_show('{$v.id}',1)" href="javascript:;">点击禁用</span>
					{else}
						<span class="label label-danger radius" onClick="is_show('{$v.id}',0)" href="javascript:;">点击开启</span>
					{/if}
				</td>
				<td class="td-manage">
					<a style="text-decoration:none" class="ml-5" href="{:url('edit',array('id'=>$v['id']))}" title="编辑">
						<i class="Hui-iconfont" style="font-size:20px;">&#xe6df;</i>
					</a>
					<a style="text-decoration:none" class="ml-5" onClick="del('{$v.id}')" href="javascript:;" title="删除">
						<i class="Hui-iconfont" style="font-size:20px;">&#xe6e2;</i>
					</a>
				</td>
			</tr>
			{/foreach}
			{if count($list)<=0 }
			<tr class="text-c">
				<td colspan="7">
					暂无数据
				</td>
			</tr>
			{/if}
			</tbody>
		</table>
	</div>

	{$page}

</div>

{include file="public:footer_js"}

<script type="text/javascript" src="__STATIC__/admin/lib/layer/2.4/layer.js"></script>

<script type="text/javascript">

	/**
	 * 是否启用
	 */
	function is_show(id,status){
	    var notice = "确认关闭吗？";
		if(status === 0){
	        notice = "确认开启吗？";
		}else if(status === 1){
            notice = "确定禁用吗？";
        }
		layer.confirm(notice,function () {
			$.post(
			    '{:url("is_show")}',
				{
                    id:id,
                    status:status
				},
				function (res) {
			        if(res.code === 1){
                        layer.msg(res.msg,{icon:6,time:1000});
						setTimeout(function () {
                            location.replace(location.href);
                        },2000);
					}else{
                        layer.msg(res.msg,{icon:5,time:1000});
					}
                }
			);
        });
	}

    //软删除
    function del(id)
    {
        var notice = "确认删除吗？";
        layer.confirm(notice,function () {
            $.post(
                '{:url("del")}',
                {
                    is_del: 1,
                    id : id
                },
                function (res) {
                    if(res.code === 1){
                        layer.msg("删除成功",{icon:6,time:1000});
                        setTimeout(function () {
                            location.replace(location.href);
                        },2000);

                    }else{
                        layer.msg(res.msg,{icon:5,time:1000});
                    }
                }
            );
        });
    }
</script>
</body>
</html>